package irio.gamer;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

import Logic.GamerParams;

import utils.JDouble;
import utils.JMyCombo;
import utils.JTripleValue;
import utils.JVector;
import utils.Vec;

public class RenderingSettingsFrame extends JPanel{

	public RenderingSettingsFrame() {
        String[] imageSizes = {"32","64","128","256","400","512","768","1024", "1280","1600","2048", "4096", "8192"};	        
        double[] imageVals = {32,64,128,256,400,512,768,1024, 1280,1600,2048, 4096, 8192};	        
        String[] processors = {"2","4","8","16","32","64", "128","256","512"};	        
        double[] processorsVals = {2,4,8,16,32,64, 128,256,512};	        
        final JComboBox comboImages = new JComboBox(imageSizes);

        String[] detailLevel = {"1","2","3","4","5","6", "7","8", "9", "10", "15", "20"};	        
        double[] detailLevelVals = {1,2,3,4,5,6,7,8, 9, 10, 15, 20};	        

        setLayout(new GridLayout(3,2));

        
        JMyCombo jcmbImage = new JMyCombo("Image resolution", gamer.gamerParams.imageSize, imageSizes, imageVals);
        JMyCombo jcmbProcs = new JMyCombo("Number of processors", gamer.gamerParams.processors, processors, processorsVals);
        JMyCombo jcmbColors = new JMyCombo("Use colors", gamer.gamerParams.userColors, GamerParams.yesno, GamerParams.yesnoVals);
        
//        JDouble rayStep = new JDouble("Ray step", gamer.rp.raystep, new Vec(0.001,0,0), new Vec(0.1,0,0), GamerParams.decimal);
        JMyCombo rayStep = new JMyCombo("Ray step level", gamer.rp.raystep, GamerParams.detailLevel, GamerParams.detailLevelVals);
        JMyCombo detail = new JMyCombo("Detail", gamer.rp.detail_level, detailLevel, detailLevelVals);
        JDouble camWidth = new JDouble("Field of view", gamer.rp.FOV, new Vec(0.01,0.0,0), new Vec(120,0,0), GamerParams.decimal);
        
        JMyCombo jcmbLensing = new JMyCombo("Lensing", gamer.rp.lensing, GamerParams.yesno, GamerParams.yesnoVals);
        JDouble dblLensingSize = new JDouble("Point size", gamer.rp.lensingSize, new Vec(0.00,0.0,0), new Vec(256,0,0), GamerParams.decimal);
        JDouble dblLensingStrength = new JDouble("Amplitude", gamer.rp.lensingStrength, new Vec(0.00,0.0,0), new Vec(10000,0,0), GamerParams.decimal);
        
        
        JMyCombo jcmbPreview = new JMyCombo("Preview", gamer.gamerParams.preview, GamerParams.yesno, GamerParams.yesnoVals);
        
        

        double cam = 10;
        
        add(new JTripleValue(new JLabel("Image settings"), jcmbImage, jcmbProcs, jcmbColors));
        add(new JVector("Camera", gamer.rp.camera, new Vec(-cam, -cam, -cam), new Vec(cam,cam,cam), GamerParams.decimal, "Camera defines the 3D point of the origin of the observer"));
        add(new JVector("Target", gamer.rp.target, new Vec(-cam, -cam, -cam), new Vec(cam,cam,cam), GamerParams.decimal));
        add(new JVector("Up", gamer.rp.up, new Vec(-1, -1, -1), new Vec(1,1,1), GamerParams.decimal));
        add(new JTripleValue(new JLabel("Raytracing settings"), rayStep, detail, camWidth, jcmbPreview));
        add(new JTripleValue(new JLabel("Lensing settings (experimental)"), jcmbLensing, dblLensingSize, dblLensingStrength));


	}
	
	
}
